package ma.ac.onousc.gestionfi.budget.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name = "ordre_modification_budget")
@NamedQueries({
	@NamedQuery(name = "OrdreModif.findAll", query = "select om from OrdreModif om join om.rubBudg rb"),
	@NamedQuery(name = "OrdreModif.findByTypeBudget", query = "select om from OrdreModif om join om.rubBudg rb join rb.rubrique r where ((rb.etablissement.idEtablissement = :IdETAB and :IdETAB <> null) or (rb.etablissement.idEtablissement = null and :IdETAB = null)) and rb.programmeEmploi.anneeProgrammeEmploi = :ANNEE and rb.rubrique.typeBudget.idTypeBudget=:TYPE_BUDGET") })

public class OrdreModif implements Serializable {

	
	private static final long serialVersionUID = 1L;

	@Id
	private Long idOrdre;
	
	@Temporal(TemporalType.TIMESTAMP)
	private Date dateModif;
	
	@Column(name = "REMARQUE")
	private String remarque;

	
	//bi-directional one-to-one association to RubriqueBudgetaire
	@ManyToOne(fetch=FetchType.EAGER)
	private RubriqueBudgetaire rubBudg;

	

	//bi-directional one-to-one association to Virement
	@OneToMany(mappedBy="ordreModif")
	private Set<Virement> virements;

	
	public OrdreModif() {
		super();
		// TODO Auto-generated constructor stub
	}

	
	public Long getIdOrdre() {
		return idOrdre;
	}

	public void setIdOrdre(Long idOrdre) {
		this.idOrdre = idOrdre;
	}


	public Set<Virement> getVirements() {
		return virements;
	}

	public void setVirements(Set<Virement> virements) {
		this.virements = virements;
	}

	public RubriqueBudgetaire getRubBudg() {
		return rubBudg;
	}

	public void setRubBudg(RubriqueBudgetaire rubBudg) {
		this.rubBudg = rubBudg;
	}


	public Date getDateModif() {
		return dateModif;
	}


	public void setDateModif(Date dateModif) {
		this.dateModif = dateModif;
	}


	public String getRemarque() {
		return remarque;
	}


	public void setRemarque(String remarque) {
		this.remarque = remarque;
	}

	
}
